package com.study.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the payplan database table.
 * 
 */
@Entity
@NamedQuery(name="Payplan.findAll", query="SELECT p FROM Payplan p")
public class Payplan implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int payid;

	private BigDecimal paynum;

	private BigDecimal paypercentage;

	private int payperiod;

	@Temporal(TemporalType.DATE)
	private Date paytime;

	private String remark;

	private int userid;

	//bi-directional many-to-one association to Scheduleform
	@ManyToOne
	@JoinColumn(name="schno")
	private Scheduleform scheduleform;

	//bi-directional many-to-one association to Payrecord
	@OneToMany(mappedBy="payplan")
	private List<Payrecord> payrecords;

	public Payplan() {
	}

	public int getPayid() {
		return this.payid;
	}

	public void setPayid(int payid) {
		this.payid = payid;
	}

	public BigDecimal getPaynum() {
		return this.paynum;
	}

	public void setPaynum(BigDecimal paynum) {
		this.paynum = paynum;
	}

	public BigDecimal getPaypercentage() {
		return this.paypercentage;
	}

	public void setPaypercentage(BigDecimal paypercentage) {
		this.paypercentage = paypercentage;
	}

	public int getPayperiod() {
		return this.payperiod;
	}

	public void setPayperiod(int payperiod) {
		this.payperiod = payperiod;
	}

	public Date getPaytime() {
		return this.paytime;
	}

	public void setPaytime(Date paytime) {
		this.paytime = paytime;
	}

	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int getUserid() {
		return this.userid;
	}

	public void setUserid(int userid) {
		this.userid = userid;
	}

	public Scheduleform getScheduleform() {
		return this.scheduleform;
	}

	public void setScheduleform(Scheduleform scheduleform) {
		this.scheduleform = scheduleform;
	}

	public List<Payrecord> getPayrecords() {
		return this.payrecords;
	}

	public void setPayrecords(List<Payrecord> payrecords) {
		this.payrecords = payrecords;
	}

	public Payrecord addPayrecord(Payrecord payrecord) {
		getPayrecords().add(payrecord);
		payrecord.setPayplan(this);

		return payrecord;
	}

	public Payrecord removePayrecord(Payrecord payrecord) {
		getPayrecords().remove(payrecord);
		payrecord.setPayplan(null);

		return payrecord;
	}

}